home *** CD-ROM | disk | FTP | other *** search
- DOS AND DON'TS -- Part 17
- {CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}
-
-
-
- Now you want to know how to get data
-
- off of the disk. Well this is done
-
- with the U1 command. The process is
-
- almost exactly opposite of putting
-
- data onto the disk.
-
- As usual, we have to OPEN two
-
- channels -- one to send commands and
-
- one to RECEIVE the data. We can use
-
- the same OPEN statements as before for
-
- this.
-
- After we have our files open, all
-
- we have to do is decide where we are
-
- going to get our data from. Now this
-
- can be any legal track and sector.
-
- Check the first table in this article
-
- for more info. on tracks and sectors.
-
- Most people will develop their own
-
- schemes for saving their data on the
-
- disk and the READING process will be
-
- according to this layout.
-
- After we have decided where to get
-
- the data from we must tell the
-
- computer to go to the disk drive and
-
- get it. This is done with the U1
-
- command. The syntax of the U1 command
-
- is the same as that of the U2 command.
-
- We must tell the U1 command what
-
- channel to PUT the data into, what
-
- drive to access, and what track and
-
- sector to get the data from.
-
- After the U1 command is executed,
-
- data from that particular block and
-
- sector will be contained in the buffer
-
- specified. All you have to do then is
-
- GET the data from that buffer. This
-
- is acomplished with the GET# command.
-
- A short example of all of this is
-
- shown below. It is assumed that the
-
- data we want is on track 10, and
-
- sector 15 since this is where we tried
-
- to put our data is the above examples.
-
-
- 10 OPEN15,8,15
- 20 OPEN2,8,2,"#"
- 30 :
- 40 TR=10 : SE=15
- 50 :
- 60 PRINT#15,"U1:"2;0;TR;SE
- 70 :
- 80 FOR X = 1 TO 255
- 90 GET#2,A$
- 100 PRINT A$;
- 110 NEXT X
- 120 :
- 130 CLOSE2:CLOSE15
- 140 END
-
-
- This example reads in the data on
-
- track 10, sector 15 and then prints
-
- the data to the screen. You could
-
- of course, save the data in an array
-
- or however you would like to store it.
-
- As added examples there are two
-
- programs included on this disk. One
-
- program allows you to print up to 80
-
- characters to track 10, sector 15.
-
- Please do not run this program on a
-
- LOADSTAR disk unless you are willing
-
- to lose its contents. This program MAY
-
- write over other data on the disk that
-
- is needed. Try the program on a new,
-
- formatted disk.
-
- The second program reads track 10,
-
- sector 15 and then asks you for a
-
- PASSWORD. The program then compares
-
- what the user types in with what
-
- appears on track 10, sector 15. Using
-
- this technique, you can put in some
-
- protection for any of your programs.
-
-
- The program to write on the disk
-
- is named 'WRITE' and the program to
-
- check the pass-word is called 'READ'.
-
- They are both on SIDE 2 of LOADSTAR
-
- NUMBER 7.
-
- Hope you have learned something from
-
- all of this. Go out and have fun.
-
- --------------------------------------
-